#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    int evalRPN(vector<string>& tokens) {
        stack<int> st;
        for (auto& e : tokens)
        {
            if (e == "+" || e == "-" || e == "*" || e == "/")
            {
                int x = st.top();
                st.pop();
                int y = st.top();
                st.pop();
                switch (e[0])
                {
                case '+':
                    st.push(y + x);
                    break;
                case '-':
                    st.push(y - x);
                    break;
                case '*':
                    st.push(y * x);
                    break;
                case '/':
                    st.push(y / x);
                    break;
                }
            }
            else
            {
                st.push(stoi(e));
            }
        }
        return st.top();
    }
};